package com.aerfafish.spider.neo4j.repository;

import com.aerfafish.spider.neo4j.dao.CompanyHoldShare;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;

public interface CompanyHoldShareRepository extends Neo4jRepository<CompanyHoldShare, Long> {


    @Query("merge (company:Company{code: $companyCode}) " +
            "merge (share:Share{code: $shareCode})" +
            "merge p=(company)-[r:COMPANY_HOLD_SHARE]->(share) " +
            "set r.proportion=$proportion, r.sharesNum=$sharesNum, r.sharesValue=$sharesValue")
    void save(@Param("companyCode") String companyCode,
                                @Param("shareCode") String shareCode,
                                @Param("proportion") Float proportion,
                                @Param("sharesNum") Float sharesNum,
                                @Param("sharesValue") Float sharesValue);

}
